#include <stdio.h>
#include <string.h>
#define FILE_NAME "bite.txt"
int main()
{
    //打开文件
    FILE* fp = fopen(FILE_NAME, "w");
    if(fp == NULL)
    {
        perror("file open");
    }
    //写入操作
   const char* str = "linux is easy\n";
   fwrite(str, sizeof(char), strlen(str), fp);
   fclose(fp);
   //读出操作
   fp = fopen(FILE_NAME, "r");
   char arr[20] = {0};
   fread(arr, sizeof(char), sizeof(arr) - 1, fp);
   printf("%s", arr);
   //关闭文件
   fclose(fp);
   return 0;
}
